import Vue from 'vue'
import VueRouter from 'vue-router'
import store from "../store";

Vue.use(VueRouter)

// 引入进度条
import NProgress from "nprogress"
import "nprogress/nprogress.css"

NProgress.configure({
    easing: 'ease',  // 动画方式
    speed: 500,  // 递增进度条的速度
    showSpinner: false, // 是否显示加载ico
    trickleSpeed: 200, // 自动递增间隔
    minimum: 0.3 // 初始化时的最小百分比
})

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes:[
        {
            path: "/",
            component: () =>
                import(/* webpackChunkName: "layout" */ "../layouts/BaseLayout"),
            children: [
                // 患者列表
                {
                    path: "/",
                    name:"home",
                    component: () =>
                        import(/* webpackChunkName: "home" */ "../views/Home/Home"),
                },
                {
                    path: "/patient",
                    name: "patient",
                    component: {render: h => h("router-view")},
                    children: [
                        {
                            path: "/patient",
                            name: "patient",
                            meta: {title: "分析页"},
                            component: () =>
                                import(
                                    /* webpackChunkName: "patient" */ "../views/Patient/Patient"
                                    )
                        }
                    ]
                },
                // 健康管理
                {
                    path:"/health",
                    name:"health",
                    component: { render: h => h("router-view") },
                    children:[
                        {
                            path: "/health",
                            redirect:"/health/img"
                        },
                        {
                            path: "/health/img",
                            name:"img",
                            component:()=>import( /* webpackChunkName: "health" */ "../views/Health/Img")
                        },
                        {
                            path: "/health/video",
                            name:"img",
                            component:()=>import( /* webpackChunkName: "health" */ "../views/Health/Video")
                        }
                    ]
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../views/Login/Login')
        }
    ]
})

export default router
